package com.jackrain.nea.ad.controller;

import com.alibaba.fastjson.JSONObject;
import com.jackrain.nea.ad.api.CgroupsFetchAllCmd;
import com.jackrain.nea.ad.api.CmenuDelCmd;
import com.jackrain.nea.ad.api.CmenuSaveCmd;
import com.jackrain.nea.ad.api.CmenuTreeCmd;
import com.jackrain.nea.utility.ServiceUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author lzm
 * @date 2017-11-22
 */
@Slf4j
@RestController
@Api(value = "AdmenuCtrl", description = "菜单管理控制器(测试)")
public class AdmenuCtrl {
    @RequestMapping(value = "/p/cs/saveMenu", method = RequestMethod.POST)
    @ApiOperation(value = "新增、修改功能菜单或者动作定义", notes = "新增、修改功能菜单或者动作定义")
    public JSONObject saveMenu(HttpServletRequest request,
                               @RequestParam(value = "param") String param){
        return ServiceUtil.testInvoke(CmenuSaveCmd.class, request, param);
    }

    @RequestMapping(value = "/p/cs/delMenu", method = RequestMethod.DELETE)
    @ApiOperation(value = "删除菜单", notes = "删除菜单")
    public JSONObject delMenu(HttpServletRequest request,
                              @RequestParam(value = "param")  String param){
        return ServiceUtil.testInvoke(CmenuDelCmd.class, request, param);
    }
}
